Precise iOS Toolkit  2.13.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups
Public Member Functions | Static Public Member Functions
PBSmartcard Class Reference

#import <PBSmartcard.h>

List of all members.

Public Member Functions

(PBSmartcardStatus- open
(PBSmartcardStatus- openWithDisabledBackgroundManagement
(PBSmartcardStatus- close
(PBSmartcardStatus- connect:
(PBSmartcardStatus- disconnect:
(PBSmartcardStatus- reconnect:withSlotAction:
(PBSmartcardStatus- transmit:withCommandLength:andResponseBuffer:andResponseLength:
(PBSmartcardSlotStatus- getSlotStatus
(PBSmartcardSlotStatus- DEPRECATED_ATTRIBUTE
(PBSmartcardProtocol- getCurrentProtocol
(PBSmartcardProtocol- DEPRECATED_ATTRIBUTE
(NSArray *) - getATR
(void) - smartcardInserted:
(void) - smartcardRemoved:
(void) - accessoryConnected:
(void) - accessoryDisconnected:

Static Public Member Functions

(NSString *) + stringFromStatus:

Detailed Description

Class containing the main Smartcard operations.

PBSmartCard generates the following notifications: PB_CARD_INSERTED PB_CARD_REMOVED The application can register for these notifications by adding itself as an observer on the NSNotificationCenter object (note that sender object must be set to nil): [[NSNotificationCenter defaultCenter] addObserver:myObject selector:(mySelector:) name:"PB_CARD_INSERTED" object:nil];

The initial state of the slot can be checked with "slotStatus" which is updated when PBSmartcard is initialized.

Definition at line 135 of file PBSmartcard.h.


Member Function Documentation

- (void) accessoryConnected: (NSNotification *)  notification

DEPRECATED. Use notification PBAccessoryDidConnectNotification instead (documented in PBAccessory.h).

- (void) accessoryDisconnected: (NSNotification *)  notification

DEPRECATED. Use notification PBAccessoryDidDisconnectNotification instead (documented in PBAccessory.h).

- (PBSmartcardStatus) close

Closes the library and disables all notifications. Property values are no longer reliable.

Returns:
PBSmardcardStatusSuccess if successful, otherwise an error code.
- (PBSmartcardStatus) connect: (PBSmartcardProtocol preferredProtocol

Connects to a card in the reader using a specified protocol. The card will be open exclusively for this process until released with a call to disconnect:.

Parameters:
[in]preferredProtocolThe preferred protocol for further communication.
Returns:
PBSmardcardStatusSuccess if successful, or an error code.
- (PBSmartcardSlotStatus) DEPRECATED_ATTRIBUTE

DEPRECATED, use getSlotStatus.

- (PBSmartcardProtocol) DEPRECATED_ATTRIBUTE

DEPRECATED, use getCurrentProtocol.

- (PBSmartcardStatus) disconnect: (PBSmartcardDisposition disposition

Disconnect from a previous call to connect: allowing other applications to access the card. Allows the caller to set the card in a preferred disposition for the next caller.

Parameters:
[in]dispositionThe disposition of the card in the reader.
Returns:
PBSmardcardStatusSuccess if successful, or an error code.
- (NSArray*) getATR

Returns the card ATR stored as an array of NSNumber.

- (PBSmartcardProtocol) getCurrentProtocol

Returns the protocol used by the currently connected card, if any.

- (PBSmartcardSlotStatus) getSlotStatus

Returns the current slot status of the card reader.

Initializes the library and enables notifications and PBSmartcard property values.

Returns:
PBSmardcardStatusSuccess if successful, otherwise an error code.
- (PBSmartcardStatus) openWithDisabledBackgroundManagement

Does the same initializations as open but also disables the automatic background management in the library. This method should only be used when an application expliciteley need to manage smart card operations in the background. See the document "Precise iOS Toolkit Smart Card Reader User Manual" for more details on the automatic background management in the library. This method requires at least iOS 5.x. Calling the method on iOS version < 5.x will return PBSmartcardStatusNotSupported.

Returns:
PBSmardcardStatusSuccess if successful, otherwise an error code.
- (PBSmartcardStatus) reconnect: (PBSmartcardProtocol preferredProtocol
withSlotAction: (PBSmartcardReset resetType 

Resets and reconnects to the card in the reader. This can be used to select a different interface on the card (if supported).

Parameters:
[in]preferredProtocolThe preferred protocol to use for further communication.
[in]resetTypeThe type of reset of the card to be performed.
Returns:
PBSmardcardStatusSuccess if successful, or an error code.
- (void) smartcardInserted: (NSNotification *)  notification

"Protected method", should only be used if subclassing PBSmartcard. The subclass may override this method and act accordingly, as long as [super smartcardInserted] is called. This method will be called when a smartcard is inserted in the reader.

- (void) smartcardRemoved: (NSNotification *)  notification

"Protected method", should only be used if subclassing PBSmartcard. The subclass may override this method and act accordingly, as long as [super smartcardRemoved] is called. This method will be called when a smartcard is removed from the reader.

+ (NSString*) stringFromStatus: (PBSmartcardStatus status

Converts a smartcard status code to a readable string.

- (PBSmartcardStatus) transmit: (unsigned char *)  command
withCommandLength: (unsigned short)  commandLength
andResponseBuffer: (unsigned char *)  response
andResponseLength: (unsigned short *)  responseLength 

Transmits an APDU to the card and retrieves the result of the command from the card.

Parameters:
[in]commandThe command APDU to send to the card
[in]commandLengthThe size of the command in bytes.
[out]responsePointer to the response APDU from the card. This memory must be allocated by the calling application.
[in,out]responseLengthSupplies the length in bytes of the response parameter and received the actual number of bytes received from the smart card.
Returns:
PBSmardcardStatusSuccess if successful, or an error code.

The documentation for this class was generated from the following file: